package com.rrd.hive.udf.sms;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

import static com.rrd.hive.udf.sms.HiveUdfRegexTools.*;


@Description(
        name = "sms_get_salary_income",
        value = "_FUNC_(ip) - Get salary income of sms",
        extended = "Example:\n> SELECT _FUNC_('遂宁银行','smsbody-代发工资-代发人民币12元');\n  12"
)
public class GetSalaryIncomeUDF extends UDF {
    public static HashMap<String, String> singleMap;
    public static HashMap<String, DoubleRegex> doubleMap;
    public static HashMap<String, DoubleRegex> tripleMap;
    public static HashMap<String, List<DoubleRegex>> quadraeMap;

    static {
        singleMap = initSingleMap();
        doubleMap = initDoubleMap();
        tripleMap = initTripleMap();
        quadraeMap = initQuadraeMap();
    }

    public static Configuration config() {
        System.setProperty("HADOOP_USER_NAME", "hdfs");
        Configuration conf = new Configuration();
        conf.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
        return conf;
    }


    public static void main(String[] args) throws Exception {
        GetSalaryIncomeUDF dfu = new GetSalaryIncomeUDF();
        System.out.println(dfu.evaluate("遂宁银行", "smsbody-代发工资-代发人民币12元"));
    }

    public Text evaluate(String orgName, String trimSmsBody) {
        Text res = new Text("0");
        try {
            if(orgName == null || trimSmsBody == null || trimSmsBody.equals("")) {
                return res;
            }
            String salaryIncome = "";
            if (singleMap.containsKey(orgName)) {
                //System.out.println("in singleMap");
                String pattern = singleMap.get(orgName);
                salaryIncome = hiveUdfRegexResStrInPos(trimSmsBody, pattern, 0);
            } else if (doubleMap.containsKey(orgName)) {
                //System.out.println("in doubleMap");
                DoubleRegex doubleRegex = doubleMap.get(orgName);
                if (hiveUdfRegExpEx(trimSmsBody, doubleRegex.getPattern1()) == 1) {
                    salaryIncome = hiveUdfRegexResStrInPos(trimSmsBody, doubleRegex.getPattern2(), 0);
                }
            } else if (tripleMap.containsKey(orgName)) {
                //System.out.println("in tripleMap");
                DoubleRegex doubleRegex = tripleMap.get(orgName);
                if (hiveUdfRegExpEx(trimSmsBody, doubleRegex.getPattern1()) == 0) {
                    salaryIncome = hiveUdfRegexResStrInPos(trimSmsBody, doubleRegex.getPattern2(), 0);
                }
            } else if (quadraeMap.containsKey(orgName)) {
                //System.out.println("in quadraeMap");
                List<DoubleRegex> doubleRegexes = quadraeMap.get(orgName);
                for (DoubleRegex regex : doubleRegexes) {
                    //System.out.println("regex.getSize: " + regex.getSize());
                    if (regex.getSize() == 2) {
                        //System.out.println("trimSmsBody: " + trimSmsBody);
                        //System.out.println("regex.getPattern1(): " + regex.getPattern1());
                        if (hiveUdfRegExpEx(trimSmsBody, regex.getPattern1()) == 1) {
                            salaryIncome = hiveUdfRegexResStrInPos(trimSmsBody, regex.getPattern2(), 0);
                            break;
                        }
                    } else {
                        salaryIncome = hiveUdfRegexResStrInPos(trimSmsBody, regex.getPattern1(), 0);
                    }
                }
            } else if (orgName == "山东农商银行" || orgName == "详询96668") {
                String pattern = "\\（.*工资.*交易\\）人民币[0-9.,]+元";
                salaryIncome = hiveUdfRegexResStrInPos(trimSmsBody, pattern, 0);
            }

            //System.out.println("salaryIncome: " + salaryIncome);

            if (salaryIncome != null && salaryIncome.length() > 0) {
                String salaryPattern = "[0-9.,]+元|人民币[0-9.,]+|[0-9.,]+人民币|实发[0-9.,]+";
                String salaryPattern2 = "[0-9.,]+";
                String resSalary;
                salaryIncome = hiveUdfRegExReplace(salaryIncome, ",", "");
                if (hiveUdfRegExpEx(salaryIncome, salaryPattern) == 1) {
                    String tmpSalary = hiveUdfRegexResStrInPos(salaryIncome, salaryPattern, 0);
                    resSalary = hiveUdfRegexResStrInPos(tmpSalary, salaryPattern2, 0);
                    //System.out.println("resSalary: " + resSalary);
                } else {
                    resSalary = hiveUdfRegexResStrInPos(salaryIncome, salaryPattern2, 0);
                }
                if (resSalary != null) {
                    res.set(resSalary);
                }
            }
            //System.out.println("res: " + res);
        } catch (Exception e) {
            System.out.println("Excep: " + e.getMessage());
            e.printStackTrace(System.out);
        } finally {
            return res;
        }
    }



    public static HashMap<String, String> initSingleMap() {
        HashMap<String, String> resMap = new HashMap<>();
        resMap.put("尊宝比萨","实发工资:[0-9.,]+");
        resMap.put("庄浪县财政局","实发[0-9.,]+元");
        resMap.put("诸暨市邮政局,admin","实发金额[0-9.,]+");
        resMap.put("株洲融兴村镇银行","工资,转入[0-9.,]+元");
        resMap.put("舟山自来水公司,admin","实发合计[0-9.,]+");
        resMap.put("重庆银行","工资转账存入人民币[0-9.,]+元");
        resMap.put("重庆三峡银行","工资\\（收入\\）人民币[0-9.,]+元");
        resMap.put("中智江苏","实发工资[0-9.,]+元");
        resMap.put("中原银行","代发工资工资[0-9.,]+元|代发工资入账[0-9.,]+元|实发工资[0-9.,]+元");
        resMap.put("中信银行","工资存入人民币[0-9.,]+元");
        resMap.put("中通文博技术服务有限公司","实发工资:[0-9.,]+");
        resMap.put("中通快递","实发工资[0-9.,]+");
        resMap.put("中天合创门克庆煤矿","应发工资:[0-9.,]+");
        resMap.put("中石化宁波分公司","实发工资[0-9.,]+");
        resMap.put("中宁青银村镇银行","工资[0-9.,]+元");
        resMap.put("中科生物","实发工资[0-9.,]+");
        resMap.put("中金汇","实发[0-9.,]+");
        resMap.put("中江融兴村镇银行","中间业务前台工资,转入[0-9.,]+元");
        resMap.put("中集圣达因","实发金额为:[0-9.,]+");
        resMap.put("中国邮政武冈分公司","实发工资[0-9.,]+元");
        resMap.put("中国银行吉安分行","实发工资[0-9.,]+");
        resMap.put("中国银行","\\(.*工资.*\\)人民币[0-9.,]+元|\\(工资\\)\\(.*.*\\)人民币[0-9.,]+元|实际发放[0-9.,]+元|实发工资[0-9.,]+元|入账人民币[0-9.,]+元\\（代发工资\\）");
        resMap.put("中工经联人才","实发工资[0-9.,]+");
        resMap.put("中达集团公司","实发工资:[0-9.,]+");
        resMap.put("中车株洲电机","实领合计[0-9.,]+");
        resMap.put("中策橡胶集团","实发[0-9.,]+");
        resMap.put("中策清泉综合管理处,1","实发工资[0-9.,]+ ");
        resMap.put("政务综合办公平台","工资，金额[0-9.,]+元");
        resMap.put("郑州银行","\\(工资\\),收款人民币[0-9.,]+元");
        resMap.put("郑机财务","实发工资:[0-9.,]+");
        resMap.put("正源咨询","全部薪酬合计为[0-9.,]+元");
        resMap.put("浙信村镇银行","工资收入[0-9.,]+");
        resMap.put("浙石化","实发[0-9.,]+元");
        resMap.put("浙江新农化工","实发合计：[0-9.,]+");
        resMap.put("浙江五洲新春集团","实发工资[0-9.,]+元");
        resMap.put("浙江华友钴业股份有限公司","实发合计:[0-9.,]+");
        resMap.put("浙江方大通信","实发[0-9.,]+");
        resMap.put("掌飞","实发:[0-9.,]+");
        resMap.put("长子融汇村镇银行","工资[0-9.,]+元");
        resMap.put("长治集团公司","实发工资[0-9.,]+元");
        resMap.put("长盈精密","实发金额: [0-9.,]+");
        resMap.put("长沙银行","工资转入[0-9.,]+元|工资存入[0-9.,]+元");
        resMap.put("长沙艾迪康","实发工资[0-9.,]+");
        resMap.put("长江银行","代发工资业务，金额为[0-9.,]+元");
        resMap.put("长城华西银行","工资人民币[0-9.,]+元|人民币[0-9.,]+元代发工资");
        resMap.put("长安银行","到账\\(.*工资\\/奖金\\)[0-9.,]+元");
        resMap.put("章丘齐鲁村镇银行","\\(工资\\/奖金\\)，人民币[0-9.,]+元");
        resMap.put("张家口银行","工资，金额[0-9.,]+元|工资[0-9.,]+元");
        resMap.put("张家港农商银行","工资代发转入人民币[0-9.,]+元|工资人民币[0-9.,]+元|工资转入人民币[0-9.,]+元");
        resMap.put("运城农行","实发[0-9.,]+元");
        resMap.put("云南农信","工资人民币[0-9.,]+元");
        resMap.put("云南红塔银行","工资存入人民币[0-9.,]+元");
        resMap.put("悦通知","应发合计:[0-9.,]+");
        resMap.put("酉阳融兴村镇银行","工资,转入[0-9.,]+元");
        resMap.put("邮储银行","工资公司代发金额[0-9.,]+元|工资金额[0-9.,]+元");
        resMap.put("由我科技","实发[0-9.,]+");
        resMap.put("攸县财政局","实发工资[0-9.,]+");
        resMap.put("甬政软件","实发合计[0-9.,]+");
        resMap.put("永兴材料","实发工资[0-9.,]+元");
        resMap.put("营口沿海银行","工资存入\\（非支票\\）[0-9.,]+元");
        resMap.put("营口港","实发工资:[0-9.,]+");
        resMap.put("银座银行","工资发放[0-9.,]+");
        resMap.put("银川市财政局","实发合计:[0-9.,]+");
        resMap.put("益海粮油","实发工资[0-9.,]+");
        resMap.put("益海精细","实发[0-9.,]+");
        resMap.put("易才集团","实发[0-9.,]+");
        resMap.put("宜章长行村镇银行","工资存入[0-9.,]+元");
        resMap.put("宜宾市商业银行","工资转账存入[0-9.,]+元");
        resMap.put("宜宾商业银行","[0-9.,]+元\\(.*工资.*\\)|工资转账存入[0-9.,]+元");
        resMap.put("依顿集团","税后工资:[0-9.,]+");
        resMap.put("扬子江药业","实发合计:[0-9.,]+");
        resMap.put("烟台银行","工资\\/奖金人民币[0-9.,]+元");
        resMap.put("雅安商行","\\(代发工资\\)增加[0-9.,]+元|代发工资增加[0-9.,]+元");
        resMap.put("迅达股份,admin","实发工资[0-9.,]+");
        resMap.put("雪花四川","实发工资[0-9.,]+");
        resMap.put("溆浦县财政局","实发工资[0-9.,]+元");
        resMap.put("兴贤人才","实发工资[0-9.,]+元");
        resMap.put("兴福村镇银行","转账存入[0-9.,]+元\\(.*工资\\)");
        resMap.put("邢台银行","工资(及补贴)?人民币[0-9.,]+元");
        resMap.put("新网银行","工资人民币[0-9.,]+元");
        resMap.put("孝义汇通村镇银行","工资[0-9.,]+元");
        resMap.put("湘西长行村镇银行","工资存入[0-9.,]+元|工资转入[0-9.,]+元");
        resMap.put("县联社","实发金额[0-9.,]+");
        resMap.put("西政计财处","实发[0-9.,]+元");
        resMap.put("西平中原村镇银行","工资[0-9.,]+元");
        resMap.put("西藏银行","工资收入[0-9.,]+元");
        resMap.put("西安银行","工资[0-9.,]+元");
        resMap.put("武汉农商行","工资[0-9.,]+元");
        resMap.put("无锡农商行","工资，金额[0-9.,]+元");
        resMap.put("乌兰察布市财政局","实发工资总额[0-9.,]+元");
        resMap.put("乌海银行","工资金额[0-9.,]+元");
        resMap.put("乌海市海勃湾区财政局","实发 [0-9.,]+元");
        resMap.put("文山民丰村镇银行","工资转入[0-9.,]+");
        resMap.put("温州银行","[0-9.,]+交易摘要：代发工资");
        resMap.put("潍坊银行","存入\\(.*工资.*\\)，人民币[0-9.,]+元");
        resMap.put("巍山医院,财务科","实发合计[0-9.,]+");
        resMap.put("县联社","实发金额[0-9.,]+");
        resMap.put("西政计财处","实发[0-9.,]+元");
        resMap.put("西平中原村镇银行","工资[0-9.,]+元");
        resMap.put("西藏银行","工资收入[0-9.,]+元");
        resMap.put("西安银行","工资[0-9.,]+元");
        resMap.put("武汉农商行","工资[0-9.,]+元");
        resMap.put("无锡农商行","工资，金额[0-9.,]+元");
        resMap.put("乌兰察布市财政局","实发工资总额[0-9.,]+元");
        resMap.put("乌海银行","工资金额[0-9.,]+元");
        resMap.put("乌海市海勃湾区财政局","实发 [0-9.,]+元");
        resMap.put("文山民丰村镇银行","工资转入[0-9.,]+");
        resMap.put("温州银行","[0-9.,]+交易摘要：代发工资");
        resMap.put("潍坊银行","存入\\(.*工资.*\\)，人民币[0-9.,]+元");
        resMap.put("巍山医院,财务科","实发合计[0-9.,]+");
        resMap.put("兴贤人才","实发工资[0-9.,]+元");
        resMap.put("兴福村镇银行","转账存入[0-9.,]+元\\(.*工资\\)");
        resMap.put("邢台银行","工资(及补贴)?人民币[0-9.,]+元");
        resMap.put("新网银行","工资人民币[0-9.,]+元");
        resMap.put("孝义汇通村镇银行","工资[0-9.,]+元");
        resMap.put("湘西长行村镇银行","工资存入[0-9.,]+元|工资转入[0-9.,]+元");
        resMap.put("万荣县财政局","实发工资[0-9.,]+");
        resMap.put("万邦医药","实发合计[0-9.,]+");
        resMap.put("同恒金属","实发[0-9.,]+");
        resMap.put("通源人力资源部","实发：[0-9.,]+");
        resMap.put("通源环境","实发：[0-9.,]+");
        resMap.put("通道县财政局","实发工资:[0-9.,]+元");
        resMap.put("铁岭银行","工资转入[0-9.,]+元");
        resMap.put("天津银行","工资存入人民币[0-9.,]+元");
        resMap.put("藤县桂银村镇银行","收入\\（.*工资\\）[0-9.,]+元");
        resMap.put("腾龙股份","实发合计[0-9.,]+");
        resMap.put("泰航公司","实发合计[0-9.,]+");
        resMap.put("泰安银行","工资\\/奖金，存入[0-9.,]+元");
        resMap.put("台州银行","工资[0-9.,]+|工资账户转入[0-9.,]+");
        resMap.put("苏州银行","工资￥[0-9.,]+");
        resMap.put("苏州巨峰","实际应付[0-9.,]+");
        resMap.put("四川银行凉山分行","工资存入[0-9.,]+元");
        resMap.put("四川银行","工资,存入[0-9.,]+元");
        resMap.put("四川南玻","实发[0-9.,]+");
        resMap.put("四川分公司","实发工资[0-9.,]+");
        resMap.put("顺德农商银行","工资,入账人民币[0-9.,]+元");
        resMap.put("双峰县工资中心","实发工资[0-9.,]+元");
        resMap.put("寿光村镇银行","工资转入人民币[0-9.,]+元");
        resMap.put("手机工资单","实发工资：[0-9.,]+");
        resMap.put("市二医院","实发合计[0-9.,]+");
        resMap.put("仕邦人才","实发工资[0-9.,]+元");
        resMap.put("始兴大众村镇银行","工资金额[0-9.,]+元");
        resMap.put("四川农信","到账人民币[0-9.,]+元\\(.*工资.*\\)|实发工资：[0-9.,]+元");
        resMap.put("神马电力","实发工资[0-9.,]+");
        resMap.put("深圳农商银行","\\（代发工资\\）人民币[0-9.,]+");
        resMap.put("深圳农商行","转入\\（代发工资\\）人民币[0-9.,]+|转入工资人民币[0-9.,]+元");
        resMap.put("深圳宝安桂银村镇银行","收入\\（.*工资.*\\）[0-9.,]+元");
        resMap.put("设计院","实发[0-9.,]+");
        resMap.put("绍兴银行","工资人民币[0-9.,]+元");
        resMap.put("韶山光大村镇银行","工资[0-9.,]+元");
        resMap.put("上社公司人力资源部","实发工资：[0-9.,]+");
        resMap.put("上饶银行","\\(工资\\)[0-9.,]+元");
        resMap.put("上海银行","工资人民币[0-9.,]+元");
        resMap.put("上海煦翔","实发工资：[0-9.,]+");
        resMap.put("上海外服厦门分公司","实发工资[0-9.,]+");
        resMap.put("上海外服（集团）有限公司厦门分公司","实发[0-9.,]+|实发工资[0-9.,]+");
        resMap.put("上海佩琪","实发工资：[0-9.,]+元");
        resMap.put("上海农商银行","工资存入人民币[0-9.,]+元");
        resMap.put("森松公司","实发金额[0-9.,]+");
        resMap.put("三棵树","实发工资:[0-9.,]+");
        resMap.put("润迅","税后实发：[0-9.,]+元");
        resMap.put("日照银行","存入\\(.*工资.*\\)人民币[0-9.,]+|工资存入人民币[0-9.,]+元|工资\\/奖金存入人民币[0-9.,]+元");
        resMap.put("仁寿县支付中心","实发[0-9.,]+元");
        resMap.put("泉州银行","汇款人民币[0-9.,]+元\\（附言：.*.*x工资\\）");
        resMap.put("曲靖市商业银行","\\(.*工资.*\\)转入[0-9.,]+元|工资[0-9.,]+元|工资入账[0-9.,]+元");
        resMap.put("青浦劳务公司","实发[0-9.,]+");
        resMap.put("青海银行","工资[0-9.,]+元");
        resMap.put("青海农信","工资金额[0-9.,]+元");
        resMap.put("青岛银行","工资[0-9.,]+元");
        resMap.put("前程无忧","实发工资为：[0-9.,]+");
        resMap.put("奇精机械","实发工资[0-9.,]+");
        resMap.put("齐商银行","\\(工资\\)[0-9.,]+元|\\(工资\\/奖金\\)[0-9.,]+元");
        resMap.put("齐鲁银行","存入\\(.*工资.*\\)，人民币[0-9.,]+元");
        resMap.put("浦发银行","[0-9.,]+\\[银联入账:代付代发工资\\]|存人[0-9.,]+\\[.*工资.*\\]|存人[0-9.,]+元\\[.*工资.*\\]|实付合计[0-9.,]+元");
        resMap.put("浦发村镇银行","\\（代发-工资\\）,金额[0-9.,]+元");
        resMap.put("鄱阳公安局","实发合计[0-9.,]+");
        resMap.put("平罗农村商业银行","实发合计:[0-9.,]+元");
        resMap.put("平顶山银行","工资[0-9.,]+元");
        resMap.put("平昌农科村镇银行","\\(代发工资\\)增加[0-9.,]+元");
        resMap.put("平安银行","工资理财[0-9.,]+元|工资转入人民币[0-9.,]+元");
        resMap.put("品道餐饮","税后实发合计:[0-9.,]+");
        resMap.put("盘锦银行","\\(代发工资\\)转入RMB[0-9.,]+元");
        resMap.put("宁夏银行","[0-9.,]+元\\(\\(工资\\)\\)|[0-9.,]+元\\（工资\\）|工资转入人民币[0-9.,]+元");
        resMap.put("宁夏财政厅","实发合计:[0-9.,]+");
        resMap.put("宁波奇亿金属","实发合计[0-9.,]+");
        resMap.put("宁波才烁","实发工资[0-9.,]+元");
        resMap.put("内蒙古银行","\\(.*工资.*\\)人民币[0-9.,]+元");
        resMap.put("南通中远川崎","实发工资[0-9.,]+");
        resMap.put("南商（中国）","工资发生存入人民币 [0-9.,]+");
        resMap.put("南山集团","工资为[0-9.,]+元");
        resMap.put("南平移动","实发合计[0-9.,]+元");
        resMap.put("南方人才租赁","实发工资[0-9.,]+");
        resMap.put("南玻集团","实发[0-9.,]+");
        resMap.put("纳杰","实发工资[0-9.,]+");
        resMap.put("美亚光电","实发金额[0-9.,]+");
        resMap.put("梅州客家村镇银行","工资人民币[0-9.,]+元");
        resMap.put("麻阳县财政局","实发工资:[0-9.,]+");
        resMap.put("鹿城农商银行","实际到账金额\\【[0-9.,]+\\】");
        resMap.put("泸州银行","工资入账[0-9.,]+元");
        resMap.put("临商银行","\\(工资\\/奖金\\)人民币[0-9.,]+");
        resMap.put("辽宁农信","[0-9.,]+元\\[.*工资\\]");
        resMap.put("莲花医院","实发工资:[0-9.,]+");
        resMap.put("丽江财政","实发工资：[0-9.,]+");
        resMap.put("廊坊银行","工资存入人民币[0-9.,]+元");
        resMap.put("兰州银行","\\(银联入账|兰州汇鑫诚|工资\\)人民币[0-9.,]+元");
        resMap.put("兰新公司","实发工资:[0-9.,]+");
        resMap.put("莱商银行","\\(.*工资.*\\)人民币[0-9.,]+元");
        resMap.put("昆仑银行","工资\\(摘要:报销款\\)收入[0-9.,]+元|工资收入[0-9.,]+元");
        resMap.put("跨越速运","实发工资[0-9.,]+元");
        resMap.put("科诺","实发合计[0-9.,]+");
        resMap.put("康力电梯","实发工资：[0-9.,]+");
        resMap.put("九江银行","工资[0-9.,]+元");
        resMap.put("晋中银行","代发工资[0-9.,]+元");
        resMap.put("晋商银行","工资[0-9.,]+元|工资转入[0-9.,]+元");
        resMap.put("晋城银行","转存人民币[0-9.,]+元");
        resMap.put("金堂汇金银行","工资交易收入[0-9.,]+元");
        resMap.put("金仑集团","实发工资[0-9.,]+");
        resMap.put("金华银行","工资[0-9.,]+金额[0-9.,]+元");
        resMap.put("今飞轮毂","实发工资:[0-9.,]+");
        resMap.put("叫叫管家","实发工资[0-9.,]+元");
        resMap.put("焦作中旅银行","工资[0-9.,]+元|实发[0-9.,]+元");
        resMap.put("焦煤集团","实发合计[0-9.,]+元");
        resMap.put("绛县财政局","实发工资[0-9.,]+");
        resMap.put("江阴农商银行","代发工资业务,金额[0-9.,]+元");
        resMap.put("江阴农商行","工资收入业务,金额[0-9.,]+元|工资业务,金额[0-9.,]+元");
        resMap.put("江西银行","工资收入人民币[0-9.,]+元|工资转入[0-9.,]+元|收入人民币[0-9.,]+元.*附言：工资.*");
        resMap.put("江西农商银行","工资.*\\(转入\\)人民币[0-9.,]+元|工资人民币[0-9.,]+元");
        resMap.put("福尔波西格林平湖","实得[0-9.,]+");
        resMap.put("方城凤裕村镇银行","存入\\(工资\\/奖金\\)人民币[0-9.,]+元");
        resMap.put("二连浩特市财政局","实发 [0-9.,]+元");
        resMap.put("鄂尔多斯银行","\\(.*工资.*\\)人民币[0-9.,]+元");
        resMap.put("鄂尔多斯市人大","实发工资[0-9.,]+");
        resMap.put("东营银行","[0-9.,]+元\\(工资\\/奖金\\)");
        resMap.put("东兴海关","实发金额[0-9.,]+");
        resMap.put("东莞银行","工资收入人民币[0-9.,]+元");
        resMap.put("东莞尚馥","实发薪资[0-9.,]+");
        resMap.put("东莞农商银行","工资\\(转入\\)[0-9.,]+元");
        resMap.put("东方中行","实发工资[0-9.,]+元");
        resMap.put("电车公司","实发合计:[0-9.,]+");
        resMap.put("电白区慢病中心","实发总金额：[0-9.,]+");
        resMap.put("德州银行","\\(.*银行工资\\/奖金\\)[0-9.,]+人民币");
        resMap.put("得力集团","实发工资[0-9.,]+");
        resMap.put("丹东银行","工资人民币[0-9.,]+");
        resMap.put("大连银行","\\（.*工资\\）人民币[0-9.,]+");
        resMap.put("大连精工电子","实发[0-9.,]+");
        resMap.put("达陕高速","实发合计:[0-9.,]+");
        resMap.put("楚雄红塔村镇银行","工资[0-9.,]+元");
        resMap.put("湖南农信","工资[0-9.,]+元|工资专户转入人民币[0-9.,]+元");
        resMap.put("湖北银行","工资[0-9.,]+元");
        resMap.put("湖北农信","[0-9.,]+元\\(.*工资\\)|工资代发户转入[0-9.,]+元\\(.*\\)");
        resMap.put("葫芦岛银行","工资,存入[0-9.,]+元");
        resMap.put("洪江市财政局","实发工资[0-9.,]+元");
        resMap.put("恒丰银行","工资收入[0-9.,]+");
        resMap.put("河南农信","工资.{0,2}入账[0-9.,]+|工资入账[0-9.,]+");
        resMap.put("河北银行","工资\\+[0-9.,]+元");
        resMap.put("合兴集团","实发工资[0-9.,]+");
        resMap.put("合盛硅业","实发工资[0-9.,]+");
        resMap.put("航空工业制动","工资:[0-9.,]+");
        resMap.put("桂平桂银村镇银行","收入\\（.*工资.*\\）[0-9.,]+元");
        resMap.put("桂林银行","收入\\（.*工资.*\\）[0-9.,]+元");
        resMap.put("桂林公安交警提示","实发金额[0-9.,]+元");
        resMap.put("贵州银行","工资[0-9.,]+元|工资入账人民币[0-9.,]+元");
        resMap.put("贵州农信","\\(.*工资\\)[0-9.,]+元|\\(.*工资\\)收入[0-9.,]+元|工资过渡户向您.*转入[0-9.,]+元");
        resMap.put("贵阳银行","[0-9.,]+\\[附言：.*工资.*\\]");
        resMap.put("贵阳农商银行","收入\\（.*工资\\）[0-9.,]+元");
        resMap.put("硅基半导体","实发工资:[0-9.,]+");
        resMap.put("广州银行","[0-9.,]+元\\(.*工资.*\\)");
        resMap.put("广州农商银行","工资收入人民币[0-9.,]+元");
        resMap.put("广州锦兴纺织漂染有限公司","实付工资[0-9.,]+");
        resMap.put("广元贵商村镇银行","存入[0-9.,]+\\[.*工资\\]");
        resMap.put("广西前之锦","实发合计:[0-9.,]+");
        resMap.put("沧州银行","工资存入[0-9.,]+元");
        resMap.put("采油七厂人事科","实发工资[0-9.,]+元");
        resMap.put("财政国库支付中心","实发工资[0-9.,]+");
        resMap.put("贝莱胜厦门","实发工资[0-9.,]+");
        resMap.put("北京银行","工资收入[0-9.,]+元");
        resMap.put("北京农商银行","工资收入[0-9.,]+元");
        resMap.put("保定银行","工资人民币[0-9.,]+元");
        resMap.put("邦德激光","实发工资[0-9.,]+");
        resMap.put("八亿时空","实发合计[0-9.,]+");
        resMap.put("安福城关中学","实发金额[0-9.,]+");
        resMap.put("安得医疗","实发工资:[0-9.,]+");
        resMap.put("爱仕达","实发工资：[0-9.,]+|实发工资[0-9.,]+");
        resMap.put("艾莱希斯,admin","实发工资[0-9.,]+");
        resMap.put("O乐","实发合计:[0-9.,]+");
        resMap.put("OPPO","实发金额:[0-9.,]+");
        resMap.put("JJY","工资卡工资[0-9.,]+");
        resMap.put("杭州华大海天","实发工资[0-9.,]+");
        resMap.put("杭州朝阳橡胶","最终实发[0-9.,]+");
        resMap.put("汉中移动","实发合计：[0-9.,]+");
        resMap.put("汉口银行","\\(.*工资\\)[0-9.,]+元");
        resMap.put("邯郸银行","\\(代发工资\\)存入[0-9.,]+元");
        resMap.put("海峡银行","工资存入[0-9.,]+元");
        resMap.put("成都银行","工资人民币[0-9.,]+元");
        resMap.put("成都农商银行","工资收入[0-9.,]+元");
        resMap.put("朝阳银行","代发工资[0-9.,]+元");
        resMap.put("朝晖公司,admin","综合工资[0-9.,]+");
        resMap.put("常州康辉医疗","实发工资[0-9.,]+");
        resMap.put("海南农信社","[0-9.,]+元\\(工资\\)|实发[0-9.,]+");
        resMap.put("海南海药","实发合计[0-9.,]+");
        resMap.put("海口京玉","实发工资[0-9.,]+元");
        resMap.put("海丰农商银行","\\（代发工资\\）人民币[0-9.,]+");
        resMap.put("海底捞","实发合计[0-9.,]+");
        resMap.put("华光新材","工资:[0-9.,]+");
        resMap.put("沪农商村镇银行","工资存入人民币[0-9.,]+元");
        resMap.put("湖州银行","工资金额[0-9.,]+元");
        resMap.put("湖商村镇银行","工资交易,收入人民币[0-9.,]+");
        resMap.put("龙海广电网络","实发工资[0-9.,]+");
        resMap.put("六安钢铁薪资","工资[0-9.,]+元");
        resMap.put("嘉兴银行","\\(.*工资\\)人民币[0-9.,]+");
        resMap.put("家家悦","工资[0-9.,]+");
        resMap.put("佳士科技","实发[0-9.,]+");
        resMap.put("济宁银行","\\(工资\\/奖金\\)[0-9.,]+元");
        resMap.put("吉林银行","工资存入￥[0-9.,]+元");
        resMap.put("江苏摩比斯","实际支付：[0-9.,]+");
        resMap.put("江南银行","工资人民币[0-9.,]+元|入账\\(.*工资.*\\)人民币[0-9.,]+元");
        resMap.put("建新赵氏","实发合计[0-9.,]+");
        resMap.put("赣州银行","工资金额[0-9.,]+元");
        resMap.put("甘州财政","实发工资[0-9.,]+元");
        resMap.put("甘肃银行平凉分行","实发工资[0-9.,]+元");
        resMap.put("甘肃银行","工资[0-9.,]+元|工资人民币[0-9.,]+元");
        resMap.put("甘肃信合","工资人民币[0-9.,]+元");
        resMap.put("盖州农商银行","实发工资[0-9.,]+");
        resMap.put("曲靖惠民村镇银行","工资转入[0-9.,]+元");
        resMap.put("武安村镇银行","\\(.*工资\\)增加[0-9.,]+元");
        resMap.put("枣庄银行","存入\\(工资\\/奖金\\)[0-9.,]+元");
        resMap.put("天津武清村镇银行","存入\\(.*工资.*\\)，人民币[0-9.,]+元");
        resMap.put("山西农信","工资:[0-9.,]+元");
        resMap.put("绵阳市商业银行","工资人民币[0-9.,]+元|[0-9.,]+元\\(.*工资\\)");
        resMap.put("厦门银行","工资[0-9.,]+元");
        resMap.put("陵城圆融村镇银行","\\(代发工资\\)增加[0-9.,]+元");
        resMap.put("广发银行","收入人民币[0-9.,]+元\\(.*工资\\)");
        resMap.put("广发卡中心人资部","实发[0-9.,]+元");
        resMap.put("广东农信","工资收入人民币[0-9.,]+元|向您.*账户发放工资[0-9.,]+元");
        resMap.put("广东南粤银行","\\(.*工资\\)[0-9.,]+元");
        resMap.put("济宁儒商村镇银行","工资\\/奖金[0-9.,]+元");
        resMap.put("香河益民村镇银行","\\(代发工资\\)增加[0-9.,]+元");
        resMap.put("江苏颂德企业服务","实发工资[0-9.,]+元");
        resMap.put("淮河能源","实发工资[0-9.,]+");
        resMap.put("怀化市财政局","实发工资[0-9.,]+元");
        resMap.put("基久南京分公司","实发数[0-9.,]+");
        resMap.put("徽商银行","工资[0-9.,]+元");
        resMap.put("古汉山矿","实发:[0-9.,]+");
        resMap.put("公司HR","实发工资[0-9.,]+");
        resMap.put("工资条","实发工资[0-9.,]+");
        resMap.put("工行海南省分行","实发[0-9.,]+");
        resMap.put("崇义章源钨业","实发合计[0-9.,]+元");
        resMap.put("澄迈县财政局","实发工资[0-9.,]+");
        resMap.put("安康移动人力部","实发：[0-9.,]+|实发工资：[0-9.,]+");
        resMap.put("阜新银行","工资人民币[0-9.,]+元");
        resMap.put("抚顺银行","[0-9.,]+元,工资");
        resMap.put("广西华业建筑工程有限公司","实发工资[0-9.,]+");
        resMap.put("嘉艺上海包装制品有限公司","实发工资[0-9.,]+");
        resMap.put("海宁市邮政局,嘉兴派遣公司","实发[0-9.,]+");
        resMap.put("海宁市邮政局,admin","实发[0-9.,]+");
        resMap.put("华润雪花广东公司","实发工资[0-9.,]+");
//        //new add
//        resMap.put("山东农商银行","\\（.*工资.*交易\\）人民币[0-9.,]+元");
//        resMap.put("详询96668","\\（.*工资.*交易\\）人民币[0-9.,]+元");
        return resMap;
    }

    public static HashMap<String, DoubleRegex> initDoubleMap() {
        HashMap<String, DoubleRegex> resMap = new HashMap<>();
        resMap.put("珠海华润银行", new DoubleRegex("摘要：.*工资", "人民币[0-9.,]+元"));
        resMap.put("长沙银行", new DoubleRegex("付款人：.*工资发放中心", "转账转入[0-9.,]+元"));
        resMap.put("威海市商业银行", new DoubleRegex("(工资\\/奖金)", "存入人民币[0-9.,]+元"));
        resMap.put("盛京银行", new DoubleRegex(".*工资.*", "转入人民币[0-9.,]+元"));
        resMap.put("厦门国际银行", new DoubleRegex("附言：.*工资.*", "金额CNY[0-9.,]+"));
        resMap.put("宁波银行", new DoubleRegex("业务种类=工资|业务种类=代发工资", "发生额=[0-9.,]+"));
        resMap.put("南京银行", new DoubleRegex("摘要：.*工资.*", "收到.*汇入的[0-9.,]+元|收入[0-9.,]+元"));
        resMap.put("民生银行", new DoubleRegex(".*工资.*", "存入￥[0-9.,]+元"));
        resMap.put("蒙商银行", new DoubleRegex(".*工资", "存入￥[0-9.,]+元|存入人民币[0-9.,]+元"));
        resMap.put("龙江银行", new DoubleRegex("工资发放业务", "转入人民币[0-9.,]+"));
        resMap.put("柳州银行", new DoubleRegex("摘要：工资|\\（摘要：.*工资.*\\）", "转入[0-9.,]+元|[0-9.,]+元\\（摘要：.*工资\\）"));
        resMap.put("兰州银行", new DoubleRegex("备注为.*工资", "转入人民币[0-9.,]+元"));
        resMap.put("交通银行", new DoubleRegex("摘要：.*工资|附言：.*工资", "转入[0-9.,]+元|转入资金[0-9.,]+元"));
        resMap.put("江苏银行", new DoubleRegex("摘要：\\[.*工资.*\\]", "转入人民币[0-9.,]+元"));
        resMap.put("吉林农信", new DoubleRegex("摘要：.*工资", "存入[0-9.,]+元"));
        resMap.put("华夏银行", new DoubleRegex("代发工资", "收入人民币[0-9.,]+元"));
        resMap.put("湖南三湘银行", new DoubleRegex("备注：代发工资", "转入￥[0-9.,]+|转入金额：CNY[0-9.,]+"));
        resMap.put("海南银行", new DoubleRegex("备注：.*工资", "入账[0-9.,]+元"));
        resMap.put("哈尔滨银行", new DoubleRegex("\\[工资\\]", "转入人民币[0-9.,]+元"));
        resMap.put("广西农信", new DoubleRegex("付方：.*工资.*|摘要：工资|绩效", "收入[0-9.,]+元"));
        resMap.put("广西北部湾银行", new DoubleRegex("摘要：.*工资", "金额：[0-9.,]+"));
        resMap.put("光大银行", new DoubleRegex("摘要:.*工资.*", "存入[0-9.,]+元|转入[0-9.,]+元"));
        resMap.put("富滇银行", new DoubleRegex("备注：.*工资.*", "收入￥[0-9.,]+"));
        resMap.put("承德银行", new DoubleRegex("备注:.*工资.*", "入账[0-9.,]+元"));
        resMap.put("微众银行", new DoubleRegex("备注：工资", "转入[0-9.,]+元"));
        resMap.put("长葛轩辕村镇银行", new DoubleRegex("附言：工资", "转入人民币[0-9.,]+元"));
        return resMap;
    }

    public static HashMap<String, DoubleRegex> initTripleMap() {
        HashMap<String, DoubleRegex> resMap = new HashMap<>();
        resMap.put("中国农业银行", new DoubleRegex("工资支付", "工资.*交易人民币[0-9.,]+|工资交易人民币[0-9.,]+|工资单已产生，实发[0-9.,]+元|工资奖金交易人民币[0-9.,]+|实发[0-9.,]+"));
        resMap.put("工商银行", new DoubleRegex("支出", "\\（.*工资\\）[0-9.,]+元|\\(.*工资.*\\)[0-9.,]+元"));
        return resMap;
    }

    public static HashMap<String, List<DoubleRegex>> initQuadraeMap() {
        HashMap<String, List<DoubleRegex>> resMap = new HashMap<>();
        resMap.put("重庆农村商业银行", Arrays.asList(new DoubleRegex("付款方:.*工资专户","\\[存入\\][0-9.,]+元"),
                new DoubleRegex("\\[.*工资\\][0-9.,]+元")));
        resMap.put("浙商银行", Arrays.asList(new DoubleRegex("摘要工资","增加人民币[0-9.,]+元"),
                new DoubleRegex("备注：\\（工资\\）","转账[0-9.,]+元"),
                new DoubleRegex("增加人民币[0-9.,]+元\\（“工资”\\）")));
        resMap.put("浙江农信", Arrays.asList(new DoubleRegex("对方:.*工资专户","收入[0-9.,]+"),
                new DoubleRegex("工资收入[0-9.,]+")));
        resMap.put("招商银行", Arrays.asList(new DoubleRegex("备注：.*工资.*","汇款人民币[0-9.,]+"),
                new DoubleRegex("工资，人民币[0-9.,]+|入账工资\\(.*\\)，人民币[0-9.,]+")));
        resMap.put("兴业银行", Arrays.asList(new DoubleRegex("对方户名:.*\\（.*工资.*\\）","汇入收入[0-9.,]+元"),
                new DoubleRegex("工资收入\\（工资\\）[0-9.,]+元|工资收入[0-9.,]+元")));
        resMap.put("鄞州银行", Arrays.asList(new DoubleRegex("\\（代发工资\\）","代发[0-9.,]+元"),
                new DoubleRegex("工资专用账户转入[0-9.,]+元")));
        resMap.put("唐山银行", Arrays.asList(new DoubleRegex("摘要：.*工资.*","存入[0-9.,]+元"),
                new DoubleRegex("工资[0-9.,]+元")));
        resMap.put("泰隆银行", Arrays.asList(new DoubleRegex("汇出账户.*工资专户","资金汇入人民币[0-9.,]+元"),
                new DoubleRegex("代发工资转入人民币[0-9.,]+元|工资.*转入人民币[0-9.,]+元")));
        resMap.put("遂宁银行", Arrays.asList(new DoubleRegex("代发工资","代发人民币[0-9.,]+元"),
                new DoubleRegex("工资","转入人民币[0-9.,]+元")));
        resMap.put("四川天府银行", Arrays.asList(new DoubleRegex("备注:.*工资","转账收入[0-9.,]+元"),
                new DoubleRegex("工资代发收入[0-9.,]+元")));
        resMap.put("陕西信合", Arrays.asList(new DoubleRegex("备注:.*工资.*|附言.*工资","转入[0-9.,]+元"),
                new DoubleRegex("附言\\[工资\\]","转入[0-9.,]+元")));
        resMap.put("山西银行", Arrays.asList(new DoubleRegex("\\(.*工资.*\\)","转存人民币[0-9.,]+元"),
                new DoubleRegex("代发工资:[0-9.,]+元|工资￥[0-9.,]+元|代发工资[0-9.,]+元")));
        resMap.put("江苏农信", Arrays.asList(new DoubleRegex("备注:.*工资.*|\\[备注：工资\\/奖金\\]","入账人民币[0-9.,]+元\\(付方:.*|转入人民币[0-9.,]+元"),
                new DoubleRegex("入账人民币[0-9.,]+元\\(付方:.*\\）\\[.*工资.*\\]")));
        resMap.put("建设银行", Arrays.asList(new DoubleRegex("附言：.*工资","存入人民币[0-9.,]+元|收入人民币[0-9.,]+元"),
                new DoubleRegex("工资.*收入人民币[0-9.,]+元|工资收入人民币[0-9.,]+元|工资.*存入人民币[0-9.,]+元|实发[0-9.,]+|实发工资[0-9.,]+元|工资\\/奖金\\（.*\\）收入[0-9.,]+元")));
        resMap.put("华融湘江银行", Arrays.asList(new DoubleRegex("对方留言为：转工资钱|付款方.*工资专户","汇款人民币[0-9.,]+元|转账存入人民币[0-9.,]+元"),
                new DoubleRegex("工资存入[0-9.,]+元")));
        resMap.put("黄河银行", Arrays.asList(new DoubleRegex("\\（.*工资\\）","转入[0-9.,]+元"),
                new DoubleRegex("工资过渡户转入[0-9.,]+元")));
        resMap.put("杭州银行", Arrays.asList(new DoubleRegex("款项内容为工资","发起人民币[0-9.,]+元汇款"),
                new DoubleRegex("存入[0-9.,]+元\\(工资\\)")));
        resMap.put("福建农信", Arrays.asList(new DoubleRegex("对方户名:.*工资.*","代发收入[0-9.,]+元"),
                new DoubleRegex("工资收入[0-9.,]+元|财政收入[0-9.,]+元")));
        resMap.put("稠州银行", Arrays.asList(new DoubleRegex("付款人:.*工资专户","转账收入RMB[0-9.,]+"),
                new DoubleRegex("工资收入RMB[0-9.,]+")));
        resMap.put("常熟农商银行", Arrays.asList(new DoubleRegex("\\（.*工资.*\\）","存入[0-9.,]+元"),
                new DoubleRegex("[0-9.,]+元\\(.*工资\\)")));
        resMap.put("安徽农金", Arrays.asList(new DoubleRegex("付款方:.*工资.*","转账收入[0-9.,]+元"),
                new DoubleRegex("代发工资[0-9.,]+元|工资收入[0-9.,]+元")));
        return resMap;
    }
}


